/**
 * Core VXTK library
 * Works with both CommonJS modules 1.1.1 and transport/D
 * 
 */
(function(require, exports, module) {
	var id = 'core';
	var def = {};
	var deps = [];
	/**
	 * Module factory
	 */
	def[id] = function (require, exports, module) {
		/**
		 * Gosub as described in
		 * http://bahabeach.wordpress.com/2011/04/25/dynamic-vxml-subroutines/
		 */
		var gosub = function(dest, next, args) {  
			gosub.stack = gosub.stack || [];
			gosub.stack.push(next);
			gosub.args = args;
		    return dest;
		};
		gosub.back = function(result) {
		    gosub.result = result;
		    return gosub.stack.pop();
		};
		exports.gosub = gosub;
	};
	
	if (require.define) {
		require.define(def, deps);
	} else {
		def[id](require, exports, module);
	}
})(require, exports || {}, module || {});